package info.sortierung1;

import info.helper.MMath;
import info.helper.MSort;
import info.helper.MString;
import static info.helper.MString.*;

public class Sortierung extends javax.swing.JFrame {

    int anzahl=12;
    int numberDown=1;
    int numberUp=100;
    String separator=" ";
    int[] unsorted=new int[anzahl];
    int[] sorted=new int[anzahl];
    
    public Sortierung() {
        initComponents();
    }

  
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        pnOptions = new javax.swing.JPanel();
        slAnzahl = new javax.swing.JSlider();
        lbAnzahl = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        jLabel2 = new javax.swing.JLabel();
        spinAnzahl = new javax.swing.JSpinner();
        jLabel3 = new javax.swing.JLabel();
        tbSep = new javax.swing.JTextField();
        lbSeperator = new javax.swing.JLabel();
        slMax = new javax.swing.JSlider();
        spinMax = new javax.swing.JSpinner();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        spinMin = new javax.swing.JSpinner();
        slMin = new javax.swing.JSlider();
        cbVerfahren = new javax.swing.JComboBox();
        pnAction = new javax.swing.JPanel();
        tbUnsortiert = new javax.swing.JTextField();
        bnGenerate = new javax.swing.JButton();
        bnSort = new javax.swing.JButton();
        tbOutput = new javax.swing.JTextField();
        jSeparator1 = new javax.swing.JSeparator();
        cbAutosort = new javax.swing.JCheckBox();
        lbTime = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Sortierer");
        jLabel1.setToolTipText("");

        slAnzahl.setForeground(new java.awt.Color(0, 0, 0));
        slAnzahl.setMajorTickSpacing(10);
        slAnzahl.setMaximum(50);
        slAnzahl.setMinorTickSpacing(5);
        slAnzahl.setPaintLabels(true);
        slAnzahl.setPaintTicks(true);
        slAnzahl.setToolTipText("");
        slAnzahl.setValue(12);
        slAnzahl.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                slAnzahlStateChanged(evt);
            }
        });

        lbAnzahl.setText("12 Zahlen");

        jLabel2.setText("Anzahl zu generieden Zahlen:");

        spinAnzahl.setValue(12);
        spinAnzahl.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                spinAnzahlStateChanged(evt);
            }
        });

        jLabel3.setText("Seperator:");

        tbSep.setText(" ");
        tbSep.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                tbSepKeyReleased(evt);
            }
        });

        lbSeperator.setText("\" \"");

        slMax.setForeground(new java.awt.Color(0, 0, 0));
        slMax.setMajorTickSpacing(100);
        slMax.setMaximum(1000);
        slMax.setMinorTickSpacing(50);
        slMax.setPaintTicks(true);
        slMax.setToolTipText("");
        slMax.setValue(100);
        slMax.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                slMaxStateChanged(evt);
            }
        });

        spinMax.setValue(100);
        spinMax.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                spinMaxStateChanged(evt);
            }
        });

        jLabel4.setText("Obere Grenze:");

        jLabel5.setText("Untere Grenze:");
        jLabel5.setName(""); // NOI18N

        spinMin.setValue(1);
        spinMin.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                spinMinStateChanged(evt);
            }
        });

        slMin.setForeground(new java.awt.Color(0, 0, 0));
        slMin.setMajorTickSpacing(100);
        slMin.setMaximum(1000);
        slMin.setMinorTickSpacing(50);
        slMin.setPaintTicks(true);
        slMin.setToolTipText("");
        slMin.setValue(100);
        slMin.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                slMinStateChanged(evt);
            }
        });

        cbVerfahren.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Selection Sort", "Quick Sort", " " }));

        javax.swing.GroupLayout pnOptionsLayout = new javax.swing.GroupLayout(pnOptions);
        pnOptions.setLayout(pnOptionsLayout);
        pnOptionsLayout.setHorizontalGroup(
            pnOptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jSeparator2, javax.swing.GroupLayout.Alignment.TRAILING)
            .addGroup(pnOptionsLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnOptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnOptionsLayout.createSequentialGroup()
                        .addGroup(pnOptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel5)
                            .addGroup(pnOptionsLayout.createSequentialGroup()
                                .addComponent(slMin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(spinMin, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(pnOptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel4)
                            .addGroup(pnOptionsLayout.createSequentialGroup()
                                .addComponent(slMax, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(spinMax, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap())
                    .addGroup(pnOptionsLayout.createSequentialGroup()
                        .addGroup(pnOptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pnOptionsLayout.createSequentialGroup()
                                .addGroup(pnOptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel2)
                                    .addComponent(jLabel3))
                                .addGap(18, 18, 18)
                                .addGroup(pnOptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(lbAnzahl, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(lbSeperator, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(pnOptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(pnOptionsLayout.createSequentialGroup()
                                        .addComponent(slAnzahl, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(spinAnzahl, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(tbSep, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(cbVerfahren, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 0, Short.MAX_VALUE))))
        );
        pnOptionsLayout.setVerticalGroup(
            pnOptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnOptionsLayout.createSequentialGroup()
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnOptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnOptionsLayout.createSequentialGroup()
                        .addGap(16, 16, 16)
                        .addGroup(pnOptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pnOptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel2)
                                .addComponent(lbAnzahl))
                            .addComponent(spinAnzahl, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(slAnzahl, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(pnOptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnOptionsLayout.createSequentialGroup()
                        .addGap(16, 16, 16)
                        .addComponent(jLabel3))
                    .addGroup(pnOptionsLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(pnOptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tbSep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbSeperator))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(cbVerfahren, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 16, Short.MAX_VALUE)
                .addGroup(pnOptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(jLabel5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnOptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnOptionsLayout.createSequentialGroup()
                        .addGap(16, 16, 16)
                        .addComponent(spinMax, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(slMax, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(slMin, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(pnOptionsLayout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addComponent(spinMin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(14, Short.MAX_VALUE))
        );

        tbUnsortiert.setText("Zahlen hier eingeben");

        bnGenerate.setText("Generieren");
        bnGenerate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bnGenerateActionPerformed(evt);
            }
        });

        bnSort.setText("Sortieren");
        bnSort.setMaximumSize(new java.awt.Dimension(85, 23));
        bnSort.setMinimumSize(new java.awt.Dimension(85, 23));
        bnSort.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bnSortActionPerformed(evt);
            }
        });

        tbOutput.setColumns(2);
        tbOutput.setText("Ergebniss");

        cbAutosort.setText("Automatisch Sortieren");

        lbTime.setText("jLabel6");

        javax.swing.GroupLayout pnActionLayout = new javax.swing.GroupLayout(pnAction);
        pnAction.setLayout(pnActionLayout);
        pnActionLayout.setHorizontalGroup(
            pnActionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnActionLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnActionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(tbUnsortiert)
                    .addGroup(pnActionLayout.createSequentialGroup()
                        .addComponent(bnGenerate, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addGroup(pnActionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(cbAutosort)
                            .addComponent(lbTime))
                        .addGap(18, 18, 18)
                        .addComponent(bnSort, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE))
                    .addComponent(tbOutput))
                .addContainerGap())
            .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING)
        );
        pnActionLayout.setVerticalGroup(
            pnActionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnActionLayout.createSequentialGroup()
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(tbUnsortiert, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnActionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(pnActionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(bnSort, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(bnGenerate, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pnActionLayout.createSequentialGroup()
                        .addComponent(cbAutosort)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(lbTime)))
                .addGap(18, 18, 18)
                .addComponent(tbOutput, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(39, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 661, Short.MAX_VALUE)
            .addComponent(pnOptions, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(pnAction, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(pnOptions, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(pnAction, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    public void setAnzahl(int anz){
        this.anzahl=anz;
        unsorted=new int[anzahl];
        sorted=new int[anzahl];
        lbAnzahl.setText(anz+" Zahlen");
        slAnzahl.setValue(anz);
        spinAnzahl.setValue(anz);
        generate();
    }
    
    public void setMin(int min){
        this.numberDown=min;
        if(numberDown>=numberUp){
            tbUnsortiert.setText("Error: Untere Grenze muss geringer sein als die Obere Grenze!");
            return;
        }
        slMin.setValue(min);
        spinMin.setValue(min);
        generate();
    }
    
    public void setMax(int max){
        this.numberUp=max;
        if(numberUp<=numberDown){
            tbUnsortiert.setText("Error: Obere Grenze muss größer sein als die Untere Grenze!");
            return;
        }
        slMax.setValue(max);
        spinMax.setValue(max);
        generate();
    }
    
    private void bnSortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnSortActionPerformed
        sort();
    }//GEN-LAST:event_bnSortActionPerformed

    public void setResult(int[] sorted){
        String s="";
        for(int i=0;i<sorted.length;i++){
            s+=sorted[i]+separator;
        }
        tbOutput.setText(cutEnd(s,separator.length()));
    }
    public void maybeaSort(){
        if(cbAutosort.isSelected()){
            sort();
        }
    }
    
    public void sort(){
        String raw1=tbUnsortiert.getText();
        String[] split1=raw1.split(separator);
        anzahl=split1.length;
        this.unsorted=new int[anzahl];
        for (int i = 0; i < split1.length; i++) {
            unsorted[i] = Integer.valueOf(split1[i]);
        }
        double startTime=System.currentTimeMillis();
        if(cbVerfahren.getSelectedIndex()==0){
            System.out.println("Selection Sort");
            this.sorted=MSort.selectionSort(this.unsorted);
        } else if(cbVerfahren.getSelectedIndex()==1){
            System.out.println("Quick Sort");
            this.sorted=MSort.quickSort(this.unsorted);
        }
        double endTime=System.currentTimeMillis();
        lbTime.setText((endTime-startTime)+" ");
        setResult(sorted);
    }
    
    

    public void generate(){
        try{
            String s="";
            for(int i=0; i<anzahl;i++){
                s+=String.valueOf(MMath.zufallZwischen(numberDown,numberUp)+separator);
            }
            tbUnsortiert.setText(MString.cutEnd(s,separator.length()));
            maybeaSort();
        } catch (Exception e){
            tbUnsortiert.setText("Error: "+e.getLocalizedMessage());
        }
    }
    
    private void bnGenerateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnGenerateActionPerformed
       generate();
    }//GEN-LAST:event_bnGenerateActionPerformed

    private void slAnzahlStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_slAnzahlStateChanged
        setAnzahl(slAnzahl.getValue());
    }//GEN-LAST:event_slAnzahlStateChanged

    private void spinAnzahlStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinAnzahlStateChanged
        setAnzahl((Integer) spinAnzahl.getValue());
    }//GEN-LAST:event_spinAnzahlStateChanged

    private void tbSepKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tbSepKeyReleased
       this.separator=tbSep.getText();
       lbSeperator.setText(" "+separator+" ");
       generate();
    }//GEN-LAST:event_tbSepKeyReleased

    private void slMaxStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_slMaxStateChanged
        setMax(slMax.getValue());
    }//GEN-LAST:event_slMaxStateChanged

    private void spinMaxStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinMaxStateChanged
        setMax((Integer)spinMax.getValue());
    }//GEN-LAST:event_spinMaxStateChanged

    private void spinMinStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinMinStateChanged
        setMin((Integer)spinMin.getValue());
    }//GEN-LAST:event_spinMinStateChanged

    private void slMinStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_slMinStateChanged
        setMin(slMin.getValue());
    }//GEN-LAST:event_slMinStateChanged

    
   

    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Windows".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Sortierung.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Sortierung.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Sortierung.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Sortierung.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Sortierung().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton bnGenerate;
    private javax.swing.JButton bnSort;
    private javax.swing.JCheckBox cbAutosort;
    private javax.swing.JComboBox cbVerfahren;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JLabel lbAnzahl;
    private javax.swing.JLabel lbSeperator;
    private javax.swing.JLabel lbTime;
    private javax.swing.JPanel pnAction;
    private javax.swing.JPanel pnOptions;
    private javax.swing.JSlider slAnzahl;
    private javax.swing.JSlider slMax;
    private javax.swing.JSlider slMin;
    private javax.swing.JSpinner spinAnzahl;
    private javax.swing.JSpinner spinMax;
    private javax.swing.JSpinner spinMin;
    private javax.swing.JTextField tbOutput;
    private javax.swing.JTextField tbSep;
    private javax.swing.JTextField tbUnsortiert;
    // End of variables declaration//GEN-END:variables
}
